import urllib.request as req
import urllib.parse as par
import json
url = "https://movie.douban.com/j/chart/top_list?type=11&interval_id=100:90&action=&start=0&limit=20"
header = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.26"
}
request = req.Request(url=url, headers=header)
res = req.urlopen(request)
con = res.read().decode("utf-8")
print(con)

obj = json.loads(con)

with open(file="豆瓣.json", mode="w", encoding="utf-8")as f:
    f.write(con)

